<script setup lang="ts">
  import { onMounted } from 'vue'
  import { useRoute } from 'vue-router'
  import wxConfig from '@/wx/config'

  const { meta } = useRoute()

  // 判断是否是微信环境
  const isWechat = ()=> {
    return String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger";
  }

  onMounted(() => {
    if(!isWechat()) {
      console.log('请在微信客户端打开！')
    }
    wxConfig()
  })
</script>

<template>
  <keep-alive>
    <RouterView v-if="meta.keepAlive" />
  </keep-alive>
  <RouterView v-if="!meta.keepAlive" />
</template>
